<?php /* Smarty version Smarty-3.1.14, created on 2014-03-27 15:53:17
         compiled from "F:\PDC\ProjectEnv\wauf2014\20140117v4\Sites\Admincp\Tpl\EasyUI\finance_recharge_list.html" */ ?>
<?php /*%%SmartyHeaderCode:513952f78a268f0a96-58928864%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '09ddb479c974b5c1ef4f7926a74c5ce2262fde52' => 
    array (
      0 => 'F:\\PDC\\ProjectEnv\\wauf2014\\20140117v4\\Sites\\Admincp\\Tpl\\EasyUI\\finance_recharge_list.html',
      1 => 1395903579,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '513952f78a268f0a96-58928864',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.14',
  'unifunc' => 'content_52f78a2697d4b3_46810463',
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_52f78a2697d4b3_46810463')) {function content_52f78a2697d4b3_46810463($_smarty_tpl) {?><div class="easyui-panel" id='pageSummary' title="统计信息" style="padding:10px; width:700px;">
    <table>
        <tr><td>总充值金额：<strong class="green"></strong></td><td></td></tr>
        <tr><td>已处理金额：<strong class="green"></strong></td><td>待处理金额：<strong class="green"></strong></td></tr>
    </table>
</div>
<script>
    $.post('?m=Api/FinanceRecharge&action=read_summary',function(data){
        var $strongs=$('#pageSummary').find('strong');
        $strongs.eq(0).text(data.all);
        $strongs.eq(1).text(data.confirmed);
        $strongs.eq(2).text(data.unconfirmed);
    },'json');
    </script>
<table id="dg" title="充值管理" class="easyui-datagrid" style="width:700px;height:250px" url="?m=Api/FinanceRecharge"  toolbar="#toolbar" pagination="true"  rownumbers="true" fitColumns="true" singleSelect="true">
    <thead>
        <tr>
            <th field="SerialNo" width="50">流水号</th>
            <th field="UserName" width="50">会员名称</th>
            <th field="Amount" width="50">充值金额</th>
            <th field="UserRemark" width="50">用户备注</th>
            <th field="CreatedTime" width="50">申请时间</th>
            <th field="ModifiedTime" width="50">受理时间</th>
            <th field="AdminRemark" width="50">审核备注</th>
            <th field="State" width="50" data-options="formatter:function(v,r,i){return getStateStr(v);},styler:function(v,r,i){return setRowStyler(v);}">状态</th>
        </tr>
    </thead>
</table>
<div id="toolbar">
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" id="btnConfirm" onclick="confirmItem()">审核</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" id="btnView" onclick="viewLog()">查看交易日志</a>
</div>
    
<div id="dlg" class="easyui-dialog" style="width:560px;height:300px;padding:10px 20px" closed="true" buttons="#dlg-buttons">
    <div class="ftitle">充值审核</div>
    <form id="fm" method="post">
        <div class="fitem">
            <label>流水号：</label>
            <input name="SerialNo" size='45' disabled="true"  />
        </div>
        <div class="fitem">
            <label>会员名称：</label>
            <input name="UserName" size='45' disabled="true" />
        </div>
        <div class="fitem">
            <label>充值金额：</label>
            <input name="Amount" size='45' disabled="true" />
        </div>
        <div class="fitem">
            <label for="AdminRemark">审核说明：</label>
            <textarea name="AdminRemark" rows="6" cols="60"></textarea>
        </div>
    </form>
</div>
<div id="dlg-buttons">
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveItem('1')">通过</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="saveItem('4')">不通过</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')">取消</a>
</div>
    <script type="text/javascript">
        var apiurl='?module=Api/FinanceRecharge';
        function viewLog(){
            var row = $('#dg').datagrid('getSelected');
            if (row){
            addTabMain('查看交易记录 ['+row.SerialNo+']','?m=Finance_TransactionLog_List&n='+row.SerialNo+'.html');
        }
        }
        function confirmItem(){
            var row = $('#dg').datagrid('getSelected');
            if (row){
                if(row.State!='0'){
                    $.messager.show({
                            title: '警告',
                            msg: '改记录已审核过了,请勿重复操作!'
                        });
                    return;
                }
                $('#dlg').dialog('open').dialog('setTitle','充值审核');
                $('#fm').form('load',row);
            }
        }
        function saveItem(act){
            $('#fm').form('submit',{
                url: apiurl+'&action=admin_confirm&State='+act,
                onSubmit: function(){
                    return $(this).form('validate');
                },
                success: function(result){
                    var result = eval('('+result+')');
                    if (result.errorMsg){
                        $.messager.show({
                            title: 'Error',
                            msg: result.errorMsg
                        });
                    } else {
                        $('#dlg').dialog('close');        // close the dialog
                        $('#dg').datagrid('reload');    // reload the user data
                    }
                }
            });
        }
        /**
         * 获取状态的值
         * @param {type} id
         * @param {type} v
         * @returns {String}
         * @since 1.0 2014-3-22 by sutroon
         */
        function getStateStr(v){
            switch(v){
                case '1':
                    return '已通过';
                case '4':
                    return '未通过';
                case '0':
                    return '待审核';
            }
            return '状态异常['+v+']';
        }    
         function setRowStyler(v){                
            switch(v){
                case '1':
                    return 'color:#090;';
                case '4':
                    return 'color:#F00;';
            }
	}    
    </script><?php }} ?>